<template>
  <router-view v-slot="{ Component, route }">
    <keep-alive v-if="!route.meta.keepAlive">
      <component :is="Component"></component>
    </keep-alive>
    <component :is="Component" v-else></component>
  </router-view>
  <van-tabbar v-model="active" v-show="$route.meta.showTabbar == true" class="footer">
    <van-tabbar-item icon="home-o" to="/">首页</van-tabbar-item>
    <van-tabbar-item icon="bag-o"  to="/cate">分类</van-tabbar-item>
    <van-tabbar-item icon="shopping-cart-o" to="/cart">购物车</van-tabbar-item>
    <van-tabbar-item icon="smile-o"  to="/my">我的</van-tabbar-item>
  </van-tabbar>
</template>
<script setup>
import { ref } from 'vue'
import {onMounted} from 'vue'
import { useUserStore } from './store/store';
const userStore = useUserStore();
onMounted(() => {
  userStore.initUser()
})
const active = ref(0)

</script>
<style scoped>
.footer{
  position: fixed;
  bottom: 0;
  
}
</style>
